<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="include/base.jsp" %>
<!DOCTYPE HTML>
<html>
<head>
	<meta charset="UTF-8">
	<title>首页</title>
	<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css" media="all">
	<link rel="stylesheet" type="text/css" href="../css/hou.css" media="all">
	<style type="text/css">
		.menu{
			background-color: #D9EDF7;
		}
	</style>
</head>
<body>
	<div class="container">
		<%@include file="include/top.jsp" %>
		<div class="content">
			<%@include file="include/left.jsp" %>
			
			<div class="right pull-right">
				<div class="navbar" style="width:790px;margin-bottom:0px;">
					<div class="navbar-inner">
					  <a class="brand" href="javascript:;">出版社管理</a>
					</div>			
				</div>
				<c:choose>
					<c:when test="${msg=='error'}">
						<div class="alert" style="margin-bottom:0px;">
						  <button type="button" class="close" data-dismiss="alert">&times;</button>
						  <strong>该出版社不能删除</strong>
						</div>
					</c:when>
					<c:when test="${msg=='success'}">
						<div class="alert alert-success" style="margin-bottom:0px;">
						  <button type="button" class="close" data-dismiss="alert">&times;</button>
						  <strong>删除成功</strong>
						</div>
					</c:when>
				</c:choose>
				<div class="well" style="padding:20px;">
					<table class="table table-striped" style="border:1px solid #ccc">
						<tbody style="padding:10px;">
							<tr>
								<td>#</td>
								<td>出版社</td>
								<td>修改</td>
								<td>删除</td>
							</tr>
							<c:forEach items="${publishList}" var="publish" varStatus="s">
								<tr>
									<td>${s.count}</td>
									<td>${publish.publishName}</td>
									<td><a href="/admin/modifyPublish.action?id=${publish.id}"><i class="icon-pencil"></i></a></td>
									<td class="del">
										<a href="#myModal${publish.id}" class="del" role="button" class="btn" data-toggle="modal"><i class="icon-remove"></i></a>
										
										<!--bootstrap中的弹出框 
										id和<a>中的id一致，给id一个变化的值：myModal${book.id} -->
										<div id="myModal${publish.id}" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
										  <div class="modal-header">
										    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
										    <h3 id="myModalLabel">确定删除“${publish.publishName}”吗？</h3>
										  </div>
										  <div class="modal-footer">
										    <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
										    <a href="/admin/delPublish.action?id=${publish.id}" class="btn btn-primary">确定</a>
										  </div>
										</div>
										<input type="hidden" class="pid" value="${publish.id}"/>
									</td>
									<%--使用JavaScript中自带的confirm 
									<td>
										<a href="javascript:;" class="del" role="button" rel="${publish.id}" data-toggle="modal"><i class="icon-remove"></i></a>
									</td> --%>
								</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript" src="../js/jquery.min.js"></script>
	<script type="text/javascript" src="../js/bootstrap.min.js"></script>
	<script type="text/javascript">
		/* $(function(){
			$(".del").click(function(){
				var conf=confirm("确定删除吗？");
				if(conf){
					var pid=$(this).attr("rel");
					alert(pid);
					location.href="/admin/delPublish.action?id="+pid;
				}
			});
		}); */
	</script>
</body>
</html>